home *** CD-ROM | disk | FTP | other *** search
/ Best of Shareware / Best of PC Windows Shareware 1.0 - Wayzata Technology (7111) (1993).iso / mac / DOS / PROGRAMG / GRAD / DERS3.FOR < prev    next >
Text File  |  1993-01-06  |  852b  |  25 lines

  1. C ===  Derivating with respect to: 
  2. C     X(1) X(2) X(3) X(4)                                                  
  3. C
  4.       SUBROUTINE CALFUN(X,N,FF,INF)
  5.       IMPLICIT REAL*8 (A-H,O-Z)
  6.       DIMENSION X(4)
  7.       INF = 0
  8.       DO 1 I = 2, 4
  9.         IF (X(I) .GT. 0.) GOTO 1
  10.           INF = 1
  11.   1   CONTINUE
  12.       IF (INF .EQ. 1) RETURN
  13.       FF_1=2*(X(1)-1.)**(2-1)+2*(X(1)-DSQRT(X(2)))**(2-1)
  14.       FF_2=2*(X(1)-DSQRT(X(2)))**(2-1)*(-1./2./DSQRT(X(2)))
  15.       FF_3=0.
  16.       FF_4=0.
  17.       FF = (X(1) - 1.)**2 + (X(1) - DSQRT(X(2)))**2
  18.       FF_2=FF_2+2*(X(2)-DSQRT(X(3)))**(2-1)
  19.       FF_3=FF_3+2*(X(2)-DSQRT(X(3)))**(2-1)*(-1./2./DSQRT(X(3)))+2*(X(3)
  20.      :-DSQRT(X(4)))**(2-1)
  21.       FF_4=FF_4+2*(X(3)-DSQRT(X(4)))**(2-1)*(-1./2./DSQRT(X(4)))
  22.       FF = FF + (X(2) - DSQRT(X(3)))**2 + (X(3) - DSQRT(X(4)))**2
  23.       RETURN
  24.       END
  25.